package cn.echoedu.util;
import java.sql.Types;
import java.util.Date;
public class StringUtil {
	public static Object varToSqlObject(String param){
		if(ObjectUtil.isNull(param)){
			return Types.VARCHAR;
		}
		return becomeSqlObject(param);
     }
	
	
	public static Object varToSqlObject(int param){
	  
		return becomeSqlObject(param);
	}
	public static Object varToSqlObject(boolean param){
		  int result=0;
		  if(param){
			  result=1;
		  }
		return becomeSqlObject(result);
	}
	
	public static Object varToSqlObject(char param){
		if(ObjectUtil.isNull(param)){
			return Types.VARCHAR;
		}
		return becomeSqlObject(param);
	}
	public static Object varToSqlObject(float param){
		  
		return becomeSqlObject(param);
	}
	public static Object varToSqlObject(double param){
		  
		return becomeSqlObject(param);
	}
	
	public static Object varToSqlObject(long param){
		  
		return becomeSqlObject(param);
	}
	public static Object varToSqlObject(Date param){
		if(ObjectUtil.isNull(param)){
			return Types.DATE;
		}
		return becomeSqlObject(param);
	}
	
	private static  Object becomeSqlObject(Object param){
		StringBuilder stringbuilder = new StringBuilder();
		
		appendSingleQuotes(stringbuilder).append(param);
		return 	appendSingleQuotes(stringbuilder);
	}
	public static StringBuilder appendSingleQuotes(StringBuilder sb){
		return sb.append("'");
	}
	public static StringBuilder appendComma(StringBuilder sb){
		return sb.append(",");
	}
	public static String getComma()
	{
		return ",";
	}
	public static String getBeforeTheBsrackets(){
		return "(";
	}
	public static String getAfterTheBrackets(){
		return ")";
	}
	
}
